import App from "../App"
import Home from "../views/home"
import About from "../views/about/index"
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom"



const BaseRouter = () => (
    <BrowserRouter>
        <Routes>
            <Route path="/" element={<App />} >
                {/*  
                * 在 react 中 可以通过 Navigate 组件对路由进行重新定义该组件有一个 to 属性 是指重新定义的路由
                * 如<Route path="/" element={<Navigate to="/home" />} />
                * 这个意思是指 原路由是指向 / 首页 经过 Navigate 处理之后指向的是 home 
                */}
                <Route path="/" element={<Navigate to="/home" />} />
                <Route path="/home" element={<Home />} />
                <Route path="/about" element={<About />} />
            </Route>
        </Routes>
    </BrowserRouter>
)

export default BaseRouter